#ifndef _INCLUDE_ONET_S_UDP_PEER_
#define _INCLUDE_ONET_S_UDP_PEER_

/*!
    Copright: Kai "DrHalan" Mast - www.freakybytes.org

    This file is part of OpenNetwork. See OpenNetwork.h for license information.
*/

#include "SUDPMessage.h"
#include "SUDPBigMessage.h"

#include <list>

namespace onet
{

    struct SUDPPeer
    {
        SUDPPeer(const SNetworkAddress a) : address(a), pingTime(0), pingSend(false), lastPacketID(0), connected(false), latency(500)
        {
        }

        //! The Network address
        const SNetworkAddress address;

        //! Time when ping was send
        u32 pingTime;

        //! Ping send;
        bool pingSend;

        //! Last PacketId used
        u16 lastPacketID;

        //! Array of last reliable messages (to avoid duplicates)
        //! it deletes them after latency*2
        std::map<u16, u32> lastReceived;

        //! Look for a big message
        std::vector<SUDPBigMessage> bigMessages;

        //! States wheter the Peer is connected (or just requested)
        bool connected;

        //! The network latency of the peer in ms
        u16 latency;
    };

} //!end namespace onet

#endif
